package com.liyuhan.shopping.controller;

import com.alibaba.fastjson.JSONObject;
import com.liyuhan.shopping.dto.DataResponse;
import com.liyuhan.shopping.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/getGoodsList")
    public DataResponse getGoodsList(){
        return goodsService.getGoodsList();
    }

    @RequestMapping("/getGoodsType")
    public DataResponse getGoodsType(){
        return goodsService.getGoodsType();
    }

    @RequestMapping("/getGoodsInfo")
    public DataResponse getGoodsInfo(@RequestBody JSONObject request){
        return goodsService.getGoodsInfo(request);
    }

    @RequestMapping("/getGoodsComment")
    public DataResponse getGoodsComment(@RequestBody JSONObject request){
        return goodsService.getGoodsComment(request);
    }
}
